**Replication File to Accompany "Two Sides of the Same Coin"
**please contact Amanda Murdie (murdie@uga.edu) if you have any questions

*Need a fix when you are using Stata 14
local cwd `"`c(pwd)'"'
findfile lkhb.mata
mata : pathsplit(st_global("r(fn)"), path = "", name = "")
mata : st_local("path", path)
cd `"`path'"'
do lkhb.mata
cd `"`cwd'"'

use "C:\Users\amand\Dropbox\APSA 2016 project\Data&Analysis materials\Mediation Analysis\II Replication Dataset.dta"



*Table 5 : Effect of X on Y and M 

		*Petition
		logit petitionleniency basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table1, replace se  word  alpha(0.01, 0.05)

		set scheme s1mono
		logit petitionleniency i.treatment  if validitycombagain==1, robust
		margins, at(treatment=(0(1)8))
		marginsplot
		
		*Support
		ologit revleilainvinappropriatenew basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table1, append se    word alpha(0.01, 0.05)
		
		ologit revleilainvinappropriatenew i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(5)) at(treatment=(0(1)8))
		marginsplot
		 
		 *Innocent
		ologit innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table1, append se    word alpha(0.01, 0.05)

		ologit innocent i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
		*victim 
		ologit victim basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table1 , append se    word alpha(0.01, 0.05)

		ologit victim  i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
		*Angry
		*victim 
		ologit angry basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table1 , append se    word alpha(0.01, 0.05)


		ologit angry  i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
 
 *Table 6: Effect of X & M on Y 
 
 *Petition
		logit petitionleniency innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , replace se    word alpha(0.01, 0.05)

		logit petitionleniency victim  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)
		
		logit petitionleniency angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

		logit petitionleniency innocent victim  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

	
*Support 	
		ologit revleilainvinappropriatenew  innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se    word alpha(0.01, 0.05)

		ologit revleilainvinappropriatenew   victim  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)
		
		ologit revleilainvinappropriatenew  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

		ologit revleilainvinappropriatenew   innocent victim  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)


*Table 7:  KHB - all together 	

khb logit petitionleniency i.treatment || i.innocent if validitycombagain==1, 
		outreg using Table3 , replace se    starlevels(5 1 )
khb logit petitionleniency i.treatment|| i.victim if validitycombagain==1, 
		outreg using Table3 ,merge  se    starlevels(5 1 )
khb logit petitionleniency i.treatment|| i.angry if validitycombagain==1, 
		outreg using Table3 , merge  se    starlevels(5 1 )
khb logit petitionleniency i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, 
		outreg using Table3 ,merge  se   starlevels(5 1 )


khb ologit revleilainvinappropriatenew i.treatment || i.innocent if validitycombagain==1, 
		outreg using Table3 , merge  se starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment|| i.victim if validitycombagain==1, 
		outreg using Table3 , merge se  starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment|| i.angry if validitycombagain==1, 
		outreg using Table3 ,merge  se  starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, 
		outreg using Table3 , merge se starlevels(5 1 )	
		



khb ologit revleilainvinappropriatenew i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, disentangle summary notable
khb logit petitionleniency i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, disentangle summary notable


*Table 4: summary statistics
logit petitionleniency  revleilainvinappropriatenew  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
keep if validitycombagain==1
set matsize 800
outreg2 using Summarystats,  word alpha(0.01, 0.05) replace sum(log) keep(petitionleniency revleilainvinappropriatenew innocent victim  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence) 


tab racenew if validitycombagain==1 
tab polparty if validitycombagain==1
tab religionnew if validitycombagain==1


*Online Appendix Table OA2 : Effect of X on Y and M 
clear
use "C:\Users\amand\Dropbox\APSA 2016 project\Data&Analysis materials\Mediation Analysis\II Replication Dataset.dta"

		*Petition
		logit petitionleniency basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table1, replace se  word alpha(0.01, 0.05)

		set scheme s1mono
		
		logit petitionleniency i.treatment age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		margins, at(treatment=(0(1)8))
		marginsplot
		
		*Support
		ologit revleilainvinappropriatenew basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table1, append se    word alpha(0.01, 0.05)

		ologit revleilainvinappropriatenew i.treatment age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		margins, predict(outcome(5)) at(treatment=(0(1)8))
		marginsplot
		 
		 *Innocent
		ologit innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table1, append se    word alpha(0.01, 0.05)


		ologit innocent i.treatment age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
		 
		*victim 
		ologit victim basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table1 , append se    word alpha(0.01, 0.05)


		ologit victim  i.treatment age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
		 
		*Angry
		*victim 
		ologit angry basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table1 , append se    word alpha(0.01, 0.05)


		ologit angry  i.treatment age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		 
 
 *Online Appendix Table OA3: Effect of X & M on Y 
 
 *Petition
		logit petitionleniency innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , replace se    word alpha(0.01, 0.05)

		logit petitionleniency victim  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)
		
		
		logit petitionleniency angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

		logit petitionleniency innocent victim  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

	
*Support 	
		ologit revleilainvinappropriatenew  innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se    word alpha(0.01, 0.05)

		ologit revleilainvinappropriatenew   victim  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)
		
		
		ologit revleilainvinappropriatenew  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)

		ologit revleilainvinappropriatenew   innocent victim  angry  basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3 age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence if validitycombagain==1, robust
		*outreg2 using Table2 , append se   	 word alpha(0.01, 0.05)


*Online Appendix Table OA4:  KHB - all together 	

khb logit petitionleniency i.treatment || i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 , replace se    starlevels(5 1 )
khb logit petitionleniency i.treatment|| i.victim if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 ,merge  se    starlevels(5 1 )
khb logit petitionleniency i.treatment|| i.angry if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 , merge  se    starlevels(5 1 )
khb logit petitionleniency i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 ,merge  se   starlevels(5 1 )


khb ologit revleilainvinappropriatenew i.treatment || i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 , merge  se starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment|| i.victim if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 , merge se  starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment|| i.angry if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 ,merge  se  starlevels(5 1 )
khb ologit revleilainvinappropriatenew i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )
		*outreg using Table3 , merge se starlevels(5 1 )	
		
		




khb ologit revleilainvinappropriatenew i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )disentangle summary notable
khb logit petitionleniency i.treatment || i.victim  i.angry i.innocent if validitycombagain==1, concomitant(age sexnewdict i.religionnew religious i.racenew latino educ news influence i.polparty victimofviolence )disentangle summary notable



*Online Appendix Table OA6 - innocent victim and angry with other two mediators as controls

		 *Innocent
		ologit innocent victim angry basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using TableRR1, replace se    word alpha(0.01, 0.05)


		ologit innocent  victim angry i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		graph save A

		 
		 
		*victim 
		ologit victim innocent angry basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using TableRR1 , append se    word alpha(0.01, 0.05)


		ologit victim innocent angry  i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		graph save B 
		 
		*Angry
		*victim 
		ologit angry victim innocent basic3 humanizingleila3 eventintense3 humanizingleilaintense3 basicphoto3 humanizingleilaphoto3 eventintensephoto3 humanizingleilaintensephoto3  if validitycombagain==1, robust
		outreg2 using TableRR1 , append se    word alpha(0.01, 0.05)
		

		ologit angry   victim innocent i.treatment  if validitycombagain==1, robust
		margins, predict(outcome(4))  at((mean) _all treatment=(0(1)8))
		marginsplot
		graph save C  
 
		graph combine "A" "B" "C" 
		graph save CombinedRR
		
		
		
*correlation between mediators

keep if validitycombagain==1

corr innocent victim angry
